function cap() {
    try {
        console.clear();
        sleep(200);

        captureScreen(path);
        sleep(555);
        var img = images.read(path);
        var a = new Date().getTime();
        var path = "/sdcard/Android/" + a + "_1.jpg";
        sleep(111);
        images.save(img, path, "jpg", 10);
        // var a = new Date().getTime();
        // images.save(img,  "/sdcard/Android/" + a + "_1.jpg", "jpg", 10);
        sleep(111);
        // console.show();
        log("截图完毕");

        if (!files.exists(path)) {
            console.error("截图失败,3秒后重试!");
            sleep(3000);
            return cap();
        }
    } catch (e) {
        console.error(e);
    }
    return "";
}

cap();
